<h1>栏目管理</h1>
<table>
  <tr>
    <th style="width: 8%">编号</th>
    <th style="width: 36%">名称</th>
    <th style="width: 36%">父栏目</th>
    <th style="width: 8%">排序</th>
    <th>操作</th>
  </tr>

  <% @categories.each do |category| %>
    <tr>
      <td><%= category.id %></td>
      <td><%= link_to category.name, category %></td>
      <td><%= link_to category.parent_name, category.parent_or_self %></td>
      <td><%= category.rank %></td>
      <td><%= link_to_remote image_tag('edit.png',:alt => '编辑'), :update => 'content', :method => :get, :url => edit_category_path(category) %>
        <%= link_to_remote image_tag('delete.png',:alt => '删除'), :update => "content", :url => category_url(category),:method => :delete, :confirm => "你确定删除吗?" %></td>
    </tr>
  <% end %>
</table>

<%= link_to_remote '创建目录', :update => 'content', :method => :get, :url => new_category_path %>
